﻿// My methods here.
//-----------------------------------------------------------------------
// <Copyright file=Users company=DHPD>
// Copyright (c) DHPD Corporation (http://dhpd.edu.vn). All rights reserved.
// </copyright>
// <author>HP</author>
//-----------------------------------------------------------------------


using System;
using System.Collections.Generic;
using KM.DAT;
using KM.ENT;
using KM.Models;
using CORE;
namespace KM.BUS
{
    /// <summary>
    /// This is busUsers class
    /// </summary>

    public class busUsers
    {
        public busUsers()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public void createEdit(entUsers entU)
        {
            datUsers datU = new datUsers();
            datU.createEdit(entU);
        }
        public List<entUsers> getAll(ref PagingInfoModel page)
        {
            datUsers datU = new datUsers();
            List<entUsers> lst = new List<entUsers>();
            lst = datU.getAll(ref page);
            return lst;
        }
        public List<entUsers> getAllByForeignKey(int Id, ref PagingInfoModel page)
        {
            datUsers datU = new datUsers();
            List<entUsers> lst = new List<entUsers>();
            lst = datU.getAllByForeignKey(Id, ref page);
            return lst;
        }
        public bool getLogin(ref entUsers entU)
        {
            entU.Pass = Utils.getMD5(entU.Pass);
            datUsers datU = new datUsers();
            entU = datU.getLogin(entU);
            if (entU.Id != 0)
            {
                return true;
            }
            return false;
        }
        public entUsers getInfo(int Id)
        {
            datUsers datU = new datUsers();
            entUsers entU = new entUsers();
            entU = datU.getInfo(Id);
            return entU;
        }
        public bool delete(int Id)
        {
            datUsers datU = new datUsers();
            datU.delete(Id);
            return true;
        }
    }
}
